<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app" style="border: 1px solid red; padding: 10px;">
    <h1>测试具名插槽</h1>
    <named-slot>
      <p style="color:red" slot="header">传给子组件header插槽的内容</p>
      <p style="color:blue" slot="content">传给子组件content插槽的内容</p>
      <p style="color:green" slot="footer">传给子组件footer插槽的内容</p>
    </named-slot>
  </div>
  
  <template id="named-slot">
    <div style="border: 1px solid blue; padding: 10px;">
      <slot name="header">头部</slot>
      <slot name="content">默认内容</slot>
      <slot name="footer">底部</slot>
    </div>
  </template>
  
  <script src="js/vue.js"></script>
  <script>
    const app = new Vue({
      el: '#app',
      components: {
        'named-slot': {
          template: '#named-slot'
        }
      }
    });
  </script>
</body>
</html>